//
//  NextFindPWViewController.m
//  OrderFood
//
//  Created by xiaofang wang on 2018/10/22.
//  Copyright © 2018年 zhiyuan. All rights reserved.
//

#import "NextFindPWViewController.h"

@interface NextFindPWViewController ()
@property (nonatomic,strong) UITextField *newpasswordTF;
@property (nonatomic,strong) UIButton *finishBtn;
@end

@implementation NextFindPWViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.name = @"找回密码";
    NSString *number = [QTTools replaceStringWithAsterisk:self.phoneNum startLocation:3 lenght:4];
    UILabel *topLb = [[UILabel alloc] initWithFrame:CGRectMake(0, 100, SCREEN_WIDTH, 20)];
    topLb.font = FONT(15);
    topLb.textAlignment = NSTextAlignmentCenter;
    topLb.text = [NSString stringWithFormat:@"为%@设置新的登录密码",number];
    [self.view addSubview:topLb];
    
    self.newpasswordTF = [[UITextField alloc] initWithFrame:CGRectMake(15, GetMaxY(topLb)+40, SCREEN_WIDTH-75, 50)];
    self.newpasswordTF.placeholder = @"请输入新密码";
    [self.newpasswordTF setValue:themeTextColor forKeyPath:@"_placeholderLabel.textColor"];
    [self.newpasswordTF setValue:[UIFont systemFontOfSize:15] forKeyPath:@"_placeholderLabel.font"];
    self.newpasswordTF.secureTextEntry = YES;
    self.newpasswordTF.keyboardType = UIKeyboardTypeNumberPad;
    [self.view addSubview:self.newpasswordTF];
    [QTTools tool_addLineWithFrame:CGRectMake(15, GetMaxY(self.newpasswordTF), SCREEN_WIDTH - 30, 1) superView:self.view];
    UIButton *seeBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    seeBtn.frame = CGRectMake(GetMaxX(self.newpasswordTF), GetMinY(self.newpasswordTF)+8, 44, 34);
    [seeBtn setImage:IMAGE(@"by") forState:UIControlStateNormal];
    [self.view addSubview:seeBtn];
    seeBtn.selected = NO;
    [seeBtn addTarget:self action:@selector(seeAction:) forControlEvents:UIControlEventTouchUpInside];
    
    _finishBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    _finishBtn.frame = CGRectMake(15, GetMaxY(self.newpasswordTF)+35, SCREEN_WIDTH-30, 44);
    _finishBtn.backgroundColor = themeColor;
    _finishBtn.layer.cornerRadius = 5;
    _finishBtn.layer.masksToBounds = YES;
    _finishBtn.titleLabel.font = [UIFont boldSystemFontOfSize:17];
    [_finishBtn setTitleColor:WHITECOLOR forState:UIControlStateNormal];
    [_finishBtn setTitle:@"完成并登录" forState:UIControlStateNormal];
    [_finishBtn addTarget:self action:@selector(finishAction:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:self.finishBtn];
}
-(void)finishAction:(UIButton *)sender{
    
    
}
-(void)seeAction:(UIButton *)sender{
    sender.selected = !sender.selected;
    if (sender.selected) {
        [sender setImage:IMAGE(@"zy") forState:UIControlStateNormal];
        self.newpasswordTF.secureTextEntry = NO;
    }else{
        [sender setImage:IMAGE(@"by") forState:UIControlStateNormal];
        self.newpasswordTF.secureTextEntry = YES;
        
    }
    
}
/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
